Object.defineProperty(exports, "__esModule", { value: !0 }),
  (exports.default = void 0);
var e,
  t = require("../../@babel/runtime/helpers/objectSpread2"),
  o = require("../../@babel/runtime/helpers/classCallCheck"),
  r = require("../../@babel/runtime/helpers/createClass"),
  n = require("../../@babel/runtime/helpers/possibleConstructorReturn"),
  a = require("../../@babel/runtime/helpers/getPrototypeOf"),
  i = require("../../@babel/runtime/helpers/inherits"),
  c =
    (e = require("./BaseLocationProvider.js")) && e.__esModule
      ? e
      : { default: e },
  u = require("@/storage/index");
exports.default = (function (e) {
  function c() {
    var e, t, r, i;
    return (
      o(this, c),
      (t = this),
      (r = a((r = c))),
      ((e = n(
        t,
        (function () {
          if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
          if (Reflect.construct.sham) return !1;
          if ("function" == typeof Proxy) return !0;
          try {
            return !Boolean.prototype.valueOf.call(
              Reflect.construct(Boolean, [], function () {}),
            );
          } catch (e) {
            return !1;
          }
        })()
          ? Reflect.construct(r, i || [], a(t).constructor)
          : r.apply(t, i),
      )).provideType = "outdoor"),
      (e.locationChangeCallback = []),
      e
    );
  }
  return (
    i(c, e),
    r(c, [
      {
        key: "startLocation",
        value: function () {
          var e = this,
            o =
              arguments.length > 0 && void 0 !== arguments[0]
                ? arguments[0]
                : {},
            r = o.success,
            n = o.fail;
          wx.startLocationUpdate({
            success: function (e) {
              console.log("开启连续定位成功"), r && r();
            },
            fail: function () {
              n && n();
            },
          }),
            wx.onLocationChange(function (o) {
              e.locationChangeCallback.forEach(function (e) {
                u.storageLocation.get() &&
                  (o = t(t({}, o), u.storageLocation.get())),
                  e && e(o);
              });
            });
        },
      },
      {
        key: "onLocationChange",
        value: function (e) {
          this.locationChangeCallback.push(e);
        },
      },
      {
        key: "stopLocation",
        value: function () {
          wx.stopLocationUpdate();
        },
      },
      {
        key: "dispose",
        value: function () {
          this.locationChangeCallback = [];
        },
      },
    ])
  );
})(c.default);
